package com.zhao.rabbitmq.two;

import com.rabbitmq.client.Channel;
import com.zhao.rabbitmq.utils.RabbitMQUtils;

import java.util.Scanner;

/**
 * @author xiaoZhao
 * @date 2022/9/26
 * @describe 生产者 发送大量消息
 */
public class Task01 {
    public static final String QUEUE_NAME = "hello";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMQUtils.getChannel();
        // 队列声明
        channel.queueDeclare(QUEUE_NAME,false,false,false,null);
        Scanner input = new Scanner(System.in);
        while (input.hasNext()){
            String message = input.next();
            channel.basicPublish("",QUEUE_NAME,null,message.getBytes());
            System.out.println("消息发送完成："+message);
        }
    }
}
